{include title="添加管理员" keywords="" description=""  file='../application/admin/view/layout/header.html' /}
<body>
<div class="x-body">
	<form method="post" class="layui-form" action="{:url('admin/admin_menu/menuAdd')}">
		{:token()}

	<div class="layui-form-item">
		<label class="layui-form-label">上级菜单：</label>
		<div class="layui-input-block">
		<select class="layui-input" name="pid">
			<option value="0">---顶级菜单---</option>
			{foreach $menu_tree as $k => $v}
				{if ($v.id==$menu_id)}
					<option selected value="{$v['id']}">{:str_repeat('　　',$v['level']).'|--'.$v['name']}</option>
				{else/}
					<option value="{$v['id']}">{:str_repeat('　　',$v['level']).'|--'.$v['name']}</option>
				{/if}

			{/foreach}
		</select>
		</div>
	</div>

    <div class="layui-form-item">
        <label class="layui-form-label"><span class="x-red">*</span>菜单名称：</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" placeholder="菜单名称" name="name">
        </div>
    </div>

	<div class="layui-form-item">
        <label class="layui-form-label">URL路径：</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" placeholder="URL路径" name="url">
			<span>如：admin/index/index</span>

		</div>
    </div>

	<div class="layui-form-item">
		<label class="layui-form-label">菜单图标：</label>
		<div class="layui-input-block">
			<input type="text" class="layui-input" placeholder="菜单图标" name="logo">
			<span>如：layui-icon-face-smile <a target="_blank" style="color: #1e9fff;" href="https://www.layui.com/doc/element/icon.html">参考地址</a></span>
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">是否显示：</label>
		<div class="layui-input-block">
		<select class="layui-input" name="type">
			<option value="0">否</option>
			<option value="1">是</option>
		</select>
		</div>
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">菜单状态：</label>
		<div class="layui-input-block">
		<select class="layui-input" name="status">
				<option value="1">正常</option>
				<option value="0">禁用</option>
		</select>
		</div>
	</div>

		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn layui-btn-normal">提交</button>
			</div>
		</div>
	</form>
</div>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
$(function(){
	//前端验证
    var check = $("form").Validform({
        tiptype: function (msg, o) {
            if (o.type == 3) {layer.msg(msg, {icon: 2});}
        },
        ajaxPost: true,
        callback: function (data) {
            if(data.status=='y'){
                layer.msg(data.info, {icon: 1});
                setTimeout(function(){
                    parent.location.reload();
                },1000);
            }else{
                $("[name=__token__]").val(data.token);
            }
        }
    });
    check.addRule([
        {ele: "[name='name']", datatype: '*1-10', nullmsg: '请填写菜单名称', errormsg: "菜单名称1至10位之间"},
    ]);
});
</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>